home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
USA Bestseller
/
USA BESTSELLER Vol 1-95 (Hepp-Computer)(1995).iso
/
e190
/
bench.asm
< prev
next >
Wrap
Assembly Source File
|
1995-02-20
|
7KB
|
354 lines
.286
;; Compact model!
LOCALS
;; ----------------- UNINITIALIZED FAR DATA --------------------------
_FARBSS SEGMENT PARA PUBLIC 'FAR_BSS'
EXTRN ram_buffer:BYTE:64016
_FARBSS ENDS
;; --------------------------- CODE ----------------------------------
_TEXT SEGMENT PARA PUBLIC 'CODE'
PUBLIC _M13WriteB,_M13WriteW1,_M13ReadW1,_M13VTransW1
PUBLIC _TwWriteB,_TwWriteW1,_TwReadW1,_TwVTrans
ASSUME CS:_TEXT,DS:_FARBSS,ES:NOTHING
ALIGN 16
;; ------------------------------------------------------------------ ;;
;; extern "C" void M13WriteB();
;; ------------------------------------------------------------------
;; Do a straight 64,000 byte Blit in mode 13h, 10 times over.
;; ------------------------------------------------------------------ ;;
_M13WriteB PROC
push ds si di
mov ax,_FARBSS
mov ds,ax
mov ax,0a000h
mov es,ax
mov bx,10
@@TopLoop:
xor di,di
mov si,OFFSET ram_buffer
mov cx,64000
rep movsb
dec bx
jnz @@TopLoop
pop di si ds
ret
_M13WriteB ENDP
ALIGN 16
;; ------------------------------------------------------------------ ;;
;; extern "C" void M13WriteW1();
;; ------------------------------------------------------------------
;; Do a straight 64,000 byte Blit in mode 13h, 10 times over.
;; ------------------------------------------------------------------ ;;
_M13WriteW1 PROC
push ds si di
mov ax,_FARBSS
mov ds,ax
mov ax,0a000h
mov es,ax
mov bx,10
@@TopLoop:
xor di,di
mov si,OFFSET ram_buffer
mov cx,64000/2
rep movsw
dec bx
jnz @@TopLoop
pop di si ds
ret
_M13WriteW1 ENDP
ALIGN 16
;; ------------------------------------------------------------------ ;;
;; extern "C" void M13ReadW1();
;; ------------------------------------------------------------------
;; Do a 64,000 byte read from mode 13h using WORD moves.
;; ------------------------------------------------------------------ ;;
_M13ReadW1 PROC
push ds si di
mov ax,0a000h
mov ds,ax
mov ax,_FARBSS
mov es,ax
mov bx,10
@@TopLoop:
mov di,OFFSET ram_buffer
xor si,si
mov cx,64000/2
rep movsw
dec bx
jnz @@TopLoop
pop di si ds
ret
_M13ReadW1 ENDP
ALIGN 16
;; ------------------------------------------------------------------ ;;
;; extern "C" void M13VTransW1();
;; ------------------------------------------------------------------
;; Video-to-Video Transfer using Word moves, aligned.
;; ------------------------------------------------------------------ ;;
_M13VTransW1 PROC
push ds si di
mov ax,0a000h
mov es,ax
mov ds,ax
mov bx,10
@@TopLoop:
xor di,di
mov si,2 ;; move _from_ 1 word ahead, to behind 1 word
mov cx,64000/2
rep movsw
dec bx
jnz @@TopLoop
pop di si ds
ret
_M13VTransW1 ENDP
ALIGN 16
;; ------------------------------------------------------------------ ;;
;; extern "C" void TwWriteB();
;; ------------------------------------------------------------------
;; Do a planar 64,000 byte Blit in Tweaked mode, 10 times over.
;; ------------------------------------------------------------------ ;;
_TwWriteB PROC
push ds si di
mov ax,_FARBSS
mov ds,ax
mov ax,0a000h
mov es,ax
mov bx,10
@@TopLoop:
mov dx,03c4h
mov al,02h
out dx,al ;; set up for map mask reg
inc dx
mov al,1 ;; start at plane 0
out dx,al
xor di,di
mov si,OFFSET ram_buffer
mov cx,16000
rep movsb
shl al,1
out dx,al ;; plane 1
xor di,di
mov cx,16000
rep movsb
shl al,1
out dx,al ;; plane 2
xor di,di
mov cx,16000
rep movsb
shl al,1
out dx,al ;; plane 3
xor di,di
mov cx,16000
rep movsb
dec bx
jnz @@TopLoop
pop di si ds
ret
_TwWriteB ENDP
ALIGN 16
;; ------------------------------------------------------------------ ;;
;; extern "C" void TwWriteW1();
;; ------------------------------------------------------------------
;; Do a planar 64,000 byte Blit in Tweaked mode, 10 times over.
;; ------------------------------------------------------------------ ;;
_TwWriteW1 PROC
push ds si di
mov ax,_FARBSS
mov ds,ax
mov ax,0a000h
mov es,ax
mov bx,10
@@TopLoop:
mov dx,03c4h
mov al,02h
out dx,al ;; set up for map mask reg
inc dx
mov al,1 ;; start at plane 0
out dx,al
xor di,di
mov si,OFFSET ram_buffer
mov cx,16000/2
rep movsw
shl al,1
out dx,al ;; plane 1
xor di,di
mov cx,16000/2
rep movsw
shl al,1
out dx,al ;; plane 2
xor di,di
mov cx,16000/2
rep movsw
shl al,1
out dx,al ;; plane 3
xor di,di
mov cx,16000/2
rep movsw
dec bx
jnz @@TopLoop
pop di si ds
ret
_TwWriteW1 ENDP
ALIGN 16
;; ------------------------------------------------------------------ ;;
;; extern "C" void TwReadW1();
;; ------------------------------------------------------------------
;; Do a planar 64,000 byte read from Tweaked mode using WORD moves.
;; ------------------------------------------------------------------ ;;
_TwReadW1 PROC
push ds si di
mov ax,0a000h
mov ds,ax
mov ax,_FARBSS
mov es,ax
mov bx,10
@@TopLoop:
mov dx,03ceh
mov al,04h
out dx,al ;; set up for Read map reg
inc dx
mov al,0 ;; start at plane 0
out dx,al
xor si,si
mov di,OFFSET ram_buffer
mov cx,16000/2
rep movsw
inc al
out dx,al ;; plane 1
xor si,si
mov cx,16000/2
rep movsw
inc al
out dx,al ;; plane 2
xor si,si
mov cx,16000/2
rep movsw
inc al
out dx,al ;; plane 3
xor si,si
mov cx,16000/2
rep movsw
dec bx
jnz @@TopLoop
pop di si ds
ret
_TwReadW1 ENDP
ALIGN 16
;; ------------------------------------------------------------------ ;;
;; extern "C" void TwVTrans();
;; ------------------------------------------------------------------
;; Do a video-to-video 64,000 byte copy, using write mode 1 of
;; the video card. This allows a 32-bit move with a single MOVSB
;; instruction, which equals 4 pixels in 'tweaked' mode.
;; ------------------------------------------------------------------ ;;
_TwVTrans PROC
push ds si di
mov ax,0a000h
mov ds,ax
mov es,ax
;; Reset map mask to all planes
mov dx,03c4h
mov ax,0f02h
out dx,ax
mov bx,10
@@TopLoop:
;; Set to write mode 1 (video-to-video transfer)
mov dx,03ceh
mov ax,04105h
out dx,ax
xor di,di
mov si,1 ;; move data from 1 byte ahead, to 1 byte behind
mov cx,64000/4
rep movsb
;; Reset back to write mode 0 (normal setting)
mov dx,03ceh
mov ax,04005h
out dx,ax
dec bx
jnz @@TopLoop
pop di si ds
ret
_TwVTrans ENDP
_TEXT ENDS
END